﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

namespace TestUser.VisualWebPart1
{
    public partial class VisualWebPart1UserControl : UserControl
    {
      
        protected void Button1_Click(object sender, EventArgs e)
        {
            SPWeb web = SPContext.Current.Web;
            string username = web.CurrentUser.LoginName;
            string group = SPContext.Current.Web.CurrentUser.Groups[0].ToString();

            lbl_message.Text = String.Format("username : {0} <br/> group : {1}", username, group);
        }
    }
}
